<?php

namespace App\Admin\Repositories\Users;

use App\Admin\Repositories\UsersExtend;
use App\Models\User;
use App\Models\Users\TalentApply as Model;
use Dcat\Admin\Repositories\EloquentRepository;

class TalentApply extends EloquentRepository
{
    /**
     * Model.
     *
     * @var string
     */
    protected $eloquentClass = Model::class;
    protected $talent_map=[
        '1'=>['xinli'=>1],
        '2'=>['zhanbu'=>1],
        '3'=>['qingting'=>1]
    ];

    public function apply($uid,$talent_id,$age_limit){
        \App\Models\UsersExtend::query()->where('uid','=',$uid)->update(['age_limit'=>$age_limit]);
        return User::query()->where(['id'=>$uid])->update(array_merge($this->talent_map[$talent_id],['authentication'=>1]));
    }
}
